package chapter05;

import java.util.Arrays;
import java.util.Enumeration;
import java.util.Properties;

public class Test04_system {
    public static void main(String[] args) {
        //复制数组
        int[] a = {1,2,3,4,5};
        int[] b = new int[5];
        int[] c = a;
        System.arraycopy(a,0,b,0,5);
        System.out.println(Arrays.toString(a));
        System.out.println(Arrays.toString(b));
        System.out.println(Arrays.toString(c));
        a[1] = 20;
        System.out.println(Arrays.toString(a));
        System.out.println(Arrays.toString(b));
        System.out.println(Arrays.toString(c));
        //输出当前时间戳
        System.out.println(System.currentTimeMillis());
        //获取系统的全部属性
        Properties properties = System.getProperties();
        Enumeration enumeration = properties.propertyNames();
        //遍历集合
        while(enumeration.hasMoreElements()){
            String key = (String)enumeration.nextElement();
            String value = System.getProperty(key);
            System.out.println(key+":"+value);
        }
        //使用runtime调用DOS命令
        Runtime runtime = Runtime.getRuntime();
        try {
            Process exec = runtime.exec("C:\\Program Files (x86)\\Tencent\\WeChat\\WeChat.exe");
            //主进程休眠2S
            Thread.sleep(2000);
            //杀死进程
            exec.destroy();
        }catch (Exception e){
            System.out.println(e.getMessage());
        }

    }
}
